package com.cl.edu.dao;

import org.springframework.stereotype.Repository;

import com.cl.core.orm.hibernate.HibernateDao;
import com.cl.edu.entity.Teacher;

@Repository
public class TeacherDAO extends HibernateDao<Teacher,Long>{
	/**
	 * 检测教师是否已存在用户名
	 * @param name
	 * @return
	 */
	public boolean hasUsername(String username)	{
		StringBuffer hql = new StringBuffer("select count(*) from Teacher model");
		hql.append(" where model.username =? ");
		int count = this.findUnique(hql.toString(),username);
		return count>0;
	} 
}
